using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace UwinEducation.Domain.Entities
{
    /// <summary>
    /// 学期实体
    /// </summary>
    [Table("basic_terms")]
    public class Term : EntityBase
    {
        public Guid Id { get; private set; }
        /// <summary>
        /// 学期名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 简称
        /// </summary>
        public string ShortName { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }

        /// <summary>
        /// 创建学期
        /// </summary>
        public static Term Create(string name, string shortName, DateTime startTime, DateTime endTime, string remarks = null)
        {
            return new Term
            {
                Id = Guid.NewGuid(),
                Name = name,
                ShortName = shortName,
                StartTime = startTime,
                EndTime = endTime,
                Remarks = remarks,
                CreatedAt = DateTime.Now
            };
        }
    }
}